package com.example.testpulsar.mq.runner;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MyApplicationRunner implements ApplicationRunner {

    @Resource
    ProducerThread producerThread;

    @Resource
    ConsumerThread consumerThread;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        new Thread(consumerThread).run();
        new Thread(producerThread).run();
    }
}
